package com.hnevc.androiduiclassone8;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        String fileName = "data.txt";
        String content = "雷利红";
        FileOutputStream fos;
        try {
            fos = openFileOutput(fileName,MODE_PRIVATE);
            fos.write(content.getBytes());
            fos.close();
        }catch (Exception e){
            e.printStackTrace();
        }
        Log.i("TAG", "onCreate:===");
        FileInputStream fis=null;
        try {
            byte[] buffer = new byte[fis.available()];
            fis.read(buffer);
            String temp = new String(buffer);
            fis.close();
        }catch (Exception E){
            E.printStackTrace();
        }
    }
}
